Skip to content

Fix integer overflow in composition time calculation#442

Open
padenot wants to merge 1 commit intomasterfrom
fix-integer-overflow-bug-2014838
Open

Fix integer overflow in composition time calculation#442
padenot wants to merge 1 commit intomasterfrom
fix-integer-overflow-bug-2014838

Conversation

@padenot
Copy link
Contributor

@padenot padenot commented Feb 13, 2026

Use checked_add() instead of unchecked addition when calculating start_composition and end_composition times. Malformed MP4 files could trigger integer overflow, causing a panic in debug builds, and (in practice in Firefox) UB bu wrap-around, and a demuxing error.

The fix returns None when overflow is detected, allowing the error to propagate gracefully rather than crashing in debug (but the end result in Firefox is the same).

BMO#2014838.

Use checked_add() instead of unchecked addition when calculating
start_composition and end_composition times. Malformed MP4 files
could trigger integer overflow, causing a panic in debug builds.

The fix returns None when overflow is detected, allowing the error
to propagate gracefully rather than crashing.

Fixes Mozilla bug 2014838.
@padenot padenot requested a review from kinetiknz February 13, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant